LIBRARY_NAME = mysql_tcl
LIBRARY_VERSION = 1.0
SO_FILE = lib$(LIBRARY_NAME)$(LIBRARY_VERSION).so

MYSQL_CONFIG = /usr/local/mysql/bin/mysql_config
CC = gcc -pipe
MACROS = -DUSE_TCL_STUBS
INCLUDE_PATH = -I. -I/usr/local/include
LIB_PATH = -L/usr/local/lib
LIBRARIES = -ltclstub8.4

$(SO_FILE): mysql_tcl.o
	$(CC) -shared $(LIB_PATH) $(shell $(MYSQL_CONFIG) --libs) $(LIBRARIES) mysql_tcl.o -o $(SO_FILE)

mysql_tcl.o: mysql_tcl.c mysql_tcl.h
	$(CC) -fPIC -c $(MACROS) $(INCLUDE_PATH) $(shell $(MYSQL_CONFIG) --cflags) mysql_tcl.c

clean:
	rm $(SO_FILE) *.o
